package com.diver.flinkdemo.Trd.zgyzh;

import com.alibaba.fastjson.JSONObject;
import com.diver.flinkdemo.utils.FlinkThreadUtil;
import com.diver.flinkdemo.utils.Trd.ZgyzhRequestUtil;
import com.diver.flinkdemo.utils.TrdUrlUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author liuC
 * @Date 2022/8/15 0015 10:41
 * @Describe
 */
@Slf4j
public class ZgyzhController {
    private FlinkThreadUtil threadUtil = new FlinkThreadUtil();

    private ZgyzhRequestUtil zgyzhRequestUtil = new ZgyzhRequestUtil();

    /**
     * 紫光翼智慧平台推送数据
     * @param data
     */
    public void zgyzhDeal(String data){
        threadUtil.threadPoolExecutor().submit(new Runnable() {
            @Override
            public void run() {
                log.info("紫光翼智慧平台推送数据：{}", data);
                JSONObject jo = JSONObject.parseObject(data);
                String url = TrdUrlUtil.ZGYZH_URL;
                String result = zgyzhRequestUtil.post(url, jo.getJSONObject("params"));
                log.info("紫光翼智慧{} 返回:{}", url, result);
            }
        });
    }
}
